package com.ymatou.iapi.productquery.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.productquery.parameter.GetProductBriefByProductIdListBean;
import com.ymatou.iapi.productquery.parameter.ProductBatchBriefDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;

/**
*批量查询商品简要信息Call
*FreeMaker Template自动生成代码
*/
public class GetProductBriefByProductIdListCall extends YmatouBaseCall{
	private static String opurl ="api/Product/GetProductBriefByProductIdList";
	
	public GetProductBriefByProductIdListCall() {
		super(EnvSetup.getSystemUrl("productquery"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public List<ProductBatchBriefDto> getProductBatchBriefDtoList(){
		
		String data = getJsonObject().get("Data").getAsJsonArray().toString();
		List<ProductBatchBriefDto> list=(List<ProductBatchBriefDto>) FormatUtil.GSONToObject(data, new TypeToken<List<ProductBatchBriefDto>>(){}.getType());
		return list;
	}
}